package com.eleadmin.lanmbda;

import java.util.ArrayList;
import java.util.List;
import java.util.function.IntConsumer;
import java.util.stream.Stream;

/**
 * @author Damon
 * @create 2022-12-13 13:00
 */
public class lambda01 {


    public static void main(String[] args) {
        foreachArr(new IntConsumer() {
            @Override
            public void accept(int value) {
                System.out.print(value);
            }
        });
        System.out.println();
        foreachArr(new IntConsumer() {
            @Override
            public void accept(int i) {
                System.out.print(i);
            }
        });
        List a = new ArrayList();
        Stream stream = a.stream();
        System.out.println();
    }

    public static void foreachArr(IntConsumer consumer) {
        int[] arr = {1, 2, 3, 4, 5, 6, 7};

        for (int i : arr) {
            consumer.accept(i);
        }
    }

}
